package com.ma.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * author: MaHX
 * date: 2019/5/26/15:30
 * description:
 **/
@RestController
public class RedisController {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @GetMapping("/redisAdd")
    public void saveRedis(){
        stringRedisTemplate.opsForValue().set("key","test");
    }

    @GetMapping("/redisGet")
    public String getRedis(){
        return stringRedisTemplate.opsForValue().get("key");
    }
}
